// custom-tab-bar/index.js
const app = getApp();

Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    "selected": 1,
    "backgroundColor": "#ffffff",
    "color": "#cdcdcd",
    "selectedColor": "#FFBE00",
    "list": [{
      "pagePath": "/pages/statistics/statistics",
      "text": "统计",
      "iconPath": "/assets/images/tabBar/account.png",
      "selectedIconPath": "/assets/images/tabBar/account_active.png"
    }, {
      "pagePath": "/pages/add/add",
      "text": "账单",
      "isSpecial": true,
      "iconPath": "/assets/images/tabBar/account_list.png",
      "selectedIconPath": "/assets/images/tabBar/add.png"
    }, {
      "pagePath": "/pages/profile/profile",
      "text": "我的",
      "iconPath": "/assets/images/tabBar/profile.png",
      "selectedIconPath": "/assets/images/tabBar/profile_active.png"
    }],
    isIphoneX: app.globalData.systemInfo.model.search('iPhone X') != -1 ? true : false
  },

  /**
   * 组件的方法列表
   */
  methods: {
    switchTab(e){
      console.log("switchTab")
      console.log(e)
      const index = e.currentTarget.dataset.index
      this.setData({
        selected: index
      })
      console.log(this.data.selected)
      // const data = e.currentTarget.dataset
      // console.log(data.index)
      // const tempTabbar = this.data.tabbar
      // tempTabbar.selected = data.index
      // this.setData({
      //   tabbar: tempTabbar
      // })
      // console.log(this.data.tabbar)
    }
  }
})
